package com.itxiuyixiu.homework.entity.dto;

import com.itxiuyixiu.homework.entity.model.RewardsAndPunishment;
import com.itxiuyixiu.homework.entity.model.Student;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * @author 黄磊
 * @date 2020/3/5
 */
public class RewardsAndPunishmentDto implements Cloneable {
    /**
     * id
     */
    private Integer id;

    /**
     * 奖惩情况说明
     */
    private String title;

    /**
     * 奖惩情况详情
     */
    private String detail;

    /**
     * 奖惩时间
     */
    private LocalDateTime time;

    /**
     * 奖励还是惩罚
     */
    private Boolean rewarded;

    private String studentId;

    public static RewardsAndPunishment parseRewardsAndPunishment(RewardsAndPunishmentDto dto , Student student) {
        RewardsAndPunishment rewardsAndPunishment = new RewardsAndPunishment();
        rewardsAndPunishment.setTitle(dto.getTitle());
        rewardsAndPunishment.setDetail(dto.getDetail());
        rewardsAndPunishment.setTime(dto.getTime());
        rewardsAndPunishment.setRewarded(dto.getRewarded());
        rewardsAndPunishment.setStudent(student);
        return rewardsAndPunishment;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public LocalDateTime getTime() {
        return time;
    }

    public void setTime(LocalDateTime time) {
        this.time = time;
    }

    public Boolean getRewarded() {
        return rewarded;
    }

    public void setRewarded(Boolean rewarded) {
        this.rewarded = rewarded;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
